package com.sc.nft.admin.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.admin.request.PagePayOrderRequest;
import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.dto.PayOrderPageDTO;
import com.sc.nft.service.PayOrderService;
import com.sc.nft.sup.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 支付轨迹表(sc_pay_order)控制层
 *
 * @author liGen
 * @version 1.0
 * @date 2023/10/19 3:22 下午
 */
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/admin/payOrder")
@Api(tags = "支付轨迹")
public class PayOrderController {

    private final PayOrderService payOrderService;

    @PostMapping(value = "/page", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "支付轨迹列表", notes = "支付轨迹列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @SysMemberLogin
    public PageResult<PayOrderPageDTO> page(@RequestBody PagePayOrderRequest request) {
        Page<PayOrderPageDTO> page = payOrderService.payOrderPageFromAdmin(request.getOrderNo(),
                request.getTradeNo(), request.getUserTel(), request.getPayType(), request.getChannel(),
                request.getOrderType(), request.getBankCardNo(), request.getStatus(), request.getStartPayTime(),
                request.getEndPayTime(), request.getPageNo(), request.getPageSize());
        return PageResult.success(page);
    }
}
